package com.geetour.columbus.core.thread;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class EmailThreadPool {

    private static ThreadPoolExecutor threadPool = new ThreadPoolExecutor(15, 30, 5, TimeUnit.SECONDS,
                                                                          new ArrayBlockingQueue<Runnable>(8),
                                                                          new ThreadPoolExecutor.DiscardOldestPolicy());

    public static void execut(Object object) {
        if (object == null) {
            throw new IllegalArgumentException("parmas is null.");
        }
        threadPool.execute(new EmailThread(object));
    }
}
